package com.fxg.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fxg.entity.Goods;
import com.fxg.mapper.GoodsMapper;
import com.fxg.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;

@Controller
public class GoodsController {

    @Autowired
    private GoodsService goodsService;
    @Autowired
    private GoodsMapper goodsMapper;


    @PostMapping("buy")
    public void bugGoods() {

        QueryWrapper<Goods> wrapper = new QueryWrapper<>();
        wrapper.eq("id",1001);
        Goods goods = new Goods();
        goods.setNumber(100);
        goodsMapper.update(goods,wrapper);

        goodsService.buyGoods();
    }


}
